<template>
	<!--商家票夹列表-->
	<view class="content">
		<view class="contenter">
			<!--发票列表显示开始-->
			<view class="indexList" v-for="(item,ticketLists) in ticketLists" @click="toDetail(item.id)">
				<view class="ad-indexList">
					<view class="ad-List">
						 <view class="list">
							<view class="ad-List-text">抬头名称:<view class="list-text-01" >{{item.invoiceName}}</view></view>
							<view class="ad-List-text">税号:<view class="list-text-01" >{{item.taxNo}}</view></view>
							<view class="ad-List-text">金额:<view class="list-text-01" >{{item.txnAmt}}</view></view>
							<view class="ad-List-text">状态:
								<view class="list-text-01" >
									<view v-if="item.state == '1'">客户新增</view>
									<view v-else-if="item.state == '2'">商家已处理</view>
									<view v-else-if="item.state == '3'">后台已处理</view>
									<view v-else-if="item.state == '4'">已退回</view>
								</view>
							</view>
						 </view>
					</view>
				</view>
			</view>
			<!--发票列表显示结束-->
		</view>
		<view class="bgimge" v-if="ticketLists.length<=0">
			<u-empty
					mode="list"
					icon="/static/icon/empty.png"
			>
			</u-empty>
		</view>
		<view class="taBbar">
			 <view-tabbar :current="0"></view-tabbar>
		</view>
	</view>
</template>

<script>
import tabbar from "@/components/tabbar/tabbar1.vue"
	export default {
				components: {
					 'view-tabbar': tabbar
				},				
				onShow() {
					uni.hideTabBar({
						animation:false
					})
				},
		data() {
			return {
				ticketLists: {},   //抬头列表
				title: 'Hello',
				
			}
		},
		onLoad() {
			var me =this;
			var merchantInfo = uni.getStorageSync("merchantInfo")
			console.log("merchantInfo="+JSON.stringify(merchantInfo))
			uni.request({
				url:me.$ServerUrl+"/invoice/api/invoice/getInvoiceListByMerchantId",
				data:{
					"merchantId":merchantInfo.id
				},
				header:{
					'content-type': 'application/x-www-form-urlencoded'
				},
				method:"GET",
				success: (res) => {
					console.log("Invoice="+res.data);
					me.ticketLists=res.data
					
				},
			})
			
			
		},
		methods: {
			toDetail(id){
				console.log('点击了呀');
				console.log(id);
			    uni.navigateTo({
			    	url:'./upticket?id=' +id,
					
			    })
				
			},
			
		}
			
	}
	
</script>

<style>
	page{
		width: 100%;
		height: 100%;
		background-color: #e1e5eb;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		height: 100%;
	}
	// list
	.indexList {
		width: 100%;
		border-radius: 10px;
	}
	.ad-indexList {
		border: 1px solid #ffffff;
		border-radius: 10px;
		background-color: #ffffff;
		margin-top: 5px;
		margin-left: 10px;
		margin-right: 10px;
		padding: 10px;
		box-shadow: 2px 2px 2px #a1a1a1;
	}
	.ad-List {
		font-size: 14px;
	}
	.ad-List-text {
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		display: flex;
		margin-bottom: 5px;
		width: 90%;
	}
	.list-text-01 {
		margin-left: 10px;
		width: 100%;
		overflow: auto;
	}
	.contenter{
		padding: 10px;
		width: 100%;
	}
	.bgimge {
		color: #999999;
		text-align: center;
		justify-content: center;
		align-items: center;
	}
</style>
